extends EntryTrigger


class_name TriggerElement
"""
监听MoveComponent事件
"""

@export_category("Move")
## 需要操作的移动组件
@export var move_component: MoveComponent = null
@export_category("")


func __check_exports() -> Dictionary:
    return IComponent.merge({
        "move_component": IComponent.find_parent.bind(self, func(x): return x is MoveComponent, move_component),
    }, super.__check_exports())

func __init_hooks() -> Dictionary:
    return IComponent.merge({
        move_component.event_moving_state_changed: __on_moving_state_changed
    }, super.__init_hooks())

func __on_moving_state_changed(node: MoveComponent, is_moving: bool) -> void:
    if is_moving:
        __on_event_enter()
    else:
        __on_event_exit()
